import router from "./router";
import "./router/permission";
import { createApp } from "vue";
import App from "./App.vue";

import "./styles/index.scss";
// 引入全局配置
import { getGlobalConfig } from "./config";
// 引入pinia
import { setupStore } from "./store";
// 引入element-plus
import { useElementPlus } from "./plugins/element-plus";
// 引入element-plus-icons
import { useElementPlusIcons } from "./plugins/element-plus-icon";

import { saveConfigToLocal } from "./utils/config-local";

const app = createApp(App);

getGlobalConfig(app).then((config) => {
  // 初始化存储全局配置信息到本地
  saveConfigToLocal(config);
  setupStore(app);
  app.use(router);
  app.use(useElementPlus);
  app.use(useElementPlusIcons);
  app.mount("#app");
});
